/*
 * Created by CntChen 2016.05.06
 * write by ES5
 */

var TileLnglatTransform = require('../builds/index');

var TileLnglatTransformGaode = TileLnglatTransform.TileLnglatTransformGaode;
var TileLnglatTransformBaidu = TileLnglatTransform.TileLnglatTransformBaidu;
var TileLnglatTransformTencent = TileLnglatTransform.TileLnglatTransformTencent;
var TileLnglatTransformBing = TileLnglatTransform.TileLnglatTransformBing;

console.log(TileLnglatTransformBing)
var lnglat = {
  lng: 120.097447,
  lat: 31.780346,
};
var level = 10;

// test for Baidu map
// test data from http://www.cnblogs.com/jz1108/archive/2011/07/02/2095376.html
console.log('Baidu map test:');
console.log('input lnglat:', lnglat, '\n', 'map level:', level);
var point_baidu = TileLnglatTransformBaidu.lnglatToPoint(lnglat.lng, lnglat.lat);
console.log('to point result:', point_baidu);
var tile_baidu = TileLnglatTransformBaidu.lnglatToTile(lnglat.lng, lnglat.lat, level);
console.log('to tile result:', tile_baidu);
console.log('verify url: http://online1.map.bdimg.com/onlinelabel/?qt=tile&x='+tile_baidu.tileX+'&y='+tile_baidu.tileY+'&z='+level);
var pixel_baidu = TileLnglatTransformBaidu.lnglatToPixel(lnglat.lng, lnglat.lat, level);
console.log('to pixel result:', pixel_baidu);
var lnglat_baidu = TileLnglatTransformBaidu.pixelToLnglat(pixel_baidu.pixelX, pixel_baidu.pixelY, tile_baidu.tileX, tile_baidu.tileY, level);
console.log('to lnglat result:', lnglat_baidu);
var lnglat_frompoint_baidu = TileLnglatTransformBaidu.pointToLnglat(point_baidu.pointX, point_baidu.pointY);
console.log('to lnglat from point result:', lnglat_frompoint_baidu);
console.log('\n');
